home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Present…nuary (Partner) - Disc 2
/
The Apple Reference and Presentations Library (Disc 2)(January 1994).iso
/
Synergy Software
/
Japanese
/
KaleidaGraph˛-PPC
/
Examples folder
/
Macro Library
/
Macro Library
Wrap
Text File
|
1993-04-14
|
3KB
|
135 lines
; Copyright 1989-1993 by Abelbeck Software
;
; Macro Library
; Version 1.0
; March 30, 1990
;
; Definitions for the "Formula" and "General Curve Fit"
;
;__Variable Definitions
x = m0;
a = m1;
b = m2;
c = m3;
d = m4;
;
;__Constant Definitions
e = exp(1);
;
;__Aliases
OR = ||;
AND = &&;
MOD = %;
if(bool) = bool ?;
else = :;
;
;__Mathematical Function Definitions
; Hyperbolic sine
sinh(x) = ((exp(x) - exp(-x)) / 2);
;
; Hyperbolic cosine
cosh(x) = ((exp(x) + exp(-x)) / 2);
;
; Hyperbolic tangent
tanh(x) = ((exp(x) - exp(-x)) / (exp(x) + exp(-x)));
;
; Log base 2
log2(x) = (log(x) / log(2));
;
; Log base n
logn(x, n) = (log(x) / log(n));
;
;__Misc. Definitions
; Random # with upper and lower bounds
number(lower, upper) = ((ran() * (upper - lower)) + lower);
;
; Arithmetic series
series(a, b) = (c0 = a + b * index());
;
; Sinc
sinc(x) = ((x) == 0.0) ? 1 : (sin(x)/(x));
;
; Minimum of two numbers
min(a, b) = (a < b ? a : b);
;
; Maximum of two numbers
max(a, b) = (a > b ? a : b);
;
; Limit x between a and b
limit(a, b, x) = (x < a ? a : (x > b ? b : x));
;
; Column Sum
sum(x) = m0 = 0\;m0 = m0 + x\;m0;
;
; Running Sum
runsum(x, sum) = m0 = 0\;sum = (m0 = m0 + x);
;
; Filter (Mask) data outside of min and max
filter(min, max, x) = unmask(1, x)\;mask(x < min || x > max, x);
;
; Quadratic Equation +
quadroot1(a, b, c) = ((-b + sqrt(b^2 - 4*a*c)) / (2 * a));
;
; Quadratic Equation -
quadroot2(a, b, c) = ((-b - sqrt(b^2 - 4*a*c)) / (2 * a));
;
; Name base column "str"
cname(str) = name(str, c0);
;
;__Curve Fit Definitions
; Linear curve fit through the origin
line0fit(a0) = a*x\;
a=a0;
;
; Linear curve fit
linefit(a0, b0) = a + b*x\;
a=a0\;b=b0;
;
; Exponential base e curve fit
expfit(a0, b0) = a * exp(b*x)\;
a=a0\;b=b0;
;
; Exponential base 10 curve fit
exp10fit(a0, b0) = a * 10^(b*x)\;
a=a0\;b=b0;
;
; Exponential base n curve fit
expnfit(n, a0, b0) = a * n^(b*x)\;
a=a0\;b=b0;
;
; Exponential-Cosine curve fit
expcosfit(a0, b0, c0, d0) = a * exp(-b*x) * cos(c*x + d)\;
a=a0\;b=b0\;c=c0\;d=d0;
;
; Exponential-Exponential curve fit
expexpfit(a0, b0, c0, d0) = a * exp(-b*x) + c * exp(-d*x)\;
a=a0\;b=b0\;c=c0\;d=d0;
;
; General Exponential curve fit
genexpfit(a0, b0, c0) = a + b * (1 - exp(-c*x))\;
a=a0\;b=b0\;c=c0;
;
; Cosine curve fit
cosfit(a0, b0, c0, d0) = a + b * cos(c*x + d)\;
a=a0\;b=b0\;c=c0\;d=d0;
;
; Gaussian curve fit
gaussfit(a0, b0, c0, d0) = a + b * exp(-(x - c)^2 / d^2)\;
a=a0\;b=b0\;c=c0\;d=d0;
;
; Power curve fit
powerfit(a0, b0) = a * x^b\;
a=a0\;b=b0;
;
; Log base 10 curve fit
logfit(a0, b0) = a + b * log(x)\;
a=a0\;b=b0;
;
; Log base e curve fit
lnfit(a0, b0) = a + b * ln(x)\;
a=a0\;b=b0;
;
; Log base n curve fit
lognfit(n, a0, b0) = a + b * logn(x, n)\;
a=a0\;b=b0;
;